package com.yn.xgame.message;

import com.yn.xgame.IMessage;

import java.util.Map;

/**
 * Mq使用Bean通信的消息
 * Created by wangboo on 17/7/13.
 */
public class MqBeanMessage implements IMessage {

    private String fromTopic;
    private String toTopic;
    private String msgId;
    private Object bean;

    public MqBeanMessage(String fromTopic, String toTopic, String msgId, Object bean) {
        this.fromTopic = fromTopic;
        this.toTopic = toTopic;
        this.msgId = msgId;
        this.bean = bean;
    }

    public String getFromTopic() {
        return fromTopic;
    }

    public String getToTopic() {
        return toTopic;
    }

    public String getMsgId() {
        return msgId;
    }

    public Object getBean() {
        return bean;
    }

    public String getBodyMapValue(String key) {
        return (String) ((Map)bean).get(key);
    }

    public int getBodyMapInt(String key) {
        return (int) ((Map) bean).get(key);
    }
}
